package com.yfree.config

import org.springframework.http.HttpStatus
import javax.servlet.http.HttpServletRequest
import javax.servlet.http.HttpServletResponse

object YConfig {
    var DEBUG = false

    object Request {
        var allowedOrigins = arrayOf<String>() // 跨域配置
        var filterCallBack = { request: HttpServletRequest, response: HttpServletResponse, handle: Any -> true } // 请求头拦截
    }

    object Response {
        var isJsonHeader = true
        var successCode = HttpStatus.OK.value() // 成功码
        var fallBackCode = HttpStatus.FORBIDDEN.value() // 降级熔断码
        var blockHandleCode = HttpStatus.FORBIDDEN.value() // 降级熔断码
        var defaultFallback = "熔断:yfree_defaultFallback"
        var defaultBlockHandle = "熔断:yfree_defaultBlockHandle"
        var successMsg = "success" // 成功信息
        var yErrorDefaultMessage = "服务器繁忙，请稍后再试。" // 执行异常错误信息
    }

    object Encrypt {
        var enable = false
        var key = "0000000000000000"
        var md5Salt = "YFree"
    }

    object Socket {
        var host = ""
        var port = 0
    }
}
